package com.omt.tarjimdinek.web.home;

import java.io.Serializable;
import java.util.Date;

import org.springframework.util.StringUtils;

import com.omt.tarjimdinek.domain.member.entity.Pays;
import com.omt.tarjimdinek.util.Constant;
import com.omt.tarjimdinek.util.StringHelper;

public class SubscriptionCriteria implements Serializable {

	/** country of member */
	private Pays pays;

	/** last name */
	private String prenom;
	
	/** birthday */
	private Date dateDeNaissance;
	
	/** first email entered */
	private String email1;
	
	/** second email entered */
	private String email2;
	
	/** first password entered */
	private String motDePasse1;
	
	/** second password entered */
	private String motDePasse2;
	
	/**
	 * @return the pays
	 */
	public Pays getPays() {
		return pays;
	}

	/**
	 * @param pays the pays to set
	 */
	public void setPays(Pays pays) {
		this.pays = pays;
	}

	public String getPrenom() {
		return prenom;
	}

	public void setPrenom(String prenom) {
		this.prenom = prenom;
	}

	public Date getDateDeNaissance() {
		return dateDeNaissance;
	}

	public void setDateDeNaissance(Date dateDeNaissance) {
		this.dateDeNaissance = dateDeNaissance;
	}

	public String getEmail1() {
		return email1;
	}

	public void setEmail1(String email1) {
		this.email1 = email1;
	}

	public String getEmail2() {
		return email2;
	}

	public void setEmail2(String email2) {
		this.email2 = email2;
	}

	public String getMotDePasse1() {
		return motDePasse1;
	}

	public void setMotDePasse1(String motDePasse1) {
		this.motDePasse1 = motDePasse1;
	}

	public String getMotDePasse2() {
		return motDePasse2;
	}

	public void setMotDePasse2(String motDePasse2) {
		this.motDePasse2 = motDePasse2;
	}

	public boolean isControleFirstFormOK() {
		return StringUtils.hasLength(prenom) && StringHelper.validate(email1, Constant.REGEX_EMAIL) 
				&& pays != null && dateDeNaissance != null && StringUtils.hasLength(motDePasse1);
	}

	public boolean isControleSecondFormOK() {
		return StringHelper.validate(email2, Constant.REGEX_EMAIL) && StringUtils.hasLength(motDePasse2);
	}
}
